from data_format import x_train,y_train,x_cross,y_cross,x_test,y_test
import pylab as pl
import svm_prediction as sp
import matplotlib.pyplot as plt
import numpy as np
import matplotlib
matplotlib.rcParams['font.sans-serif'] = ['KaiTi']
import warnings
warnings.filterwarnings('ignore')  # "error", "ignore", "always", "default", "module" or "once"

def svm_prediction_method():
    # 绘制auc变化
    pl.title("AUC change")
    pl.ylabel('auc', fontsize=20)
    pl.xlabel('times', fontsize=20)
    sp.svm_method(x_train, y_train)
    pl.legend(loc="lower right")
    pl.show()

    # 绘制roc曲线
    sp.draw_roc(x_train, y_train)
    plt.plot([0, 1], [0, 1], 'r--')
    plt.xlim([-0.1, 1.2])
    plt.ylim([-0.1, 1.2])
    plt.title('Receiver Operating Characteristic')
    plt.legend(loc='lower right')
    plt.ylabel('True Positive Rate')
    plt.xlabel('False Positive Rate')
    plt.show()

    # 绘制 accurancy，precision，recall，f1数据的直方图
    sp.draw_evolution(x_train, y_train)
    plt.title('Evaluation indicators')
    plt.ylabel('Percent')
    plt.yticks(np.arange(0, 1, 0.05))
    plt.ylim([0, 1.0])
    plt.show()

if __name__ == '__main__':
    svm_prediction_method()






